<template>
	<form  method="get" >
	    <p>查找的id<input type="text"  v-model="searchForm.mnum" name="mnum"  style="width: 150px;border-color: black"/></p>
	    <input type="button"  value="查找" @click="search"/>
	</form>
	
	<form method="get">
	    <p>删除的id<input type="text"   v-model="deleteForm.mnum" name="mnum"  style="width: 150px;border-color: black"/></p>
	    <input type="button"  value="删除" @click="del"/>
	</form>
	

	<form  method="get" >
	    <p>学号:<input type="text" name="sno"   v-model="addForm.sno" style="width: 150px;border-color: black"/></p>
	    <p>诊断医生名字:<input type="text" name="dname"   v-model="addForm.dname" style="width: 150px;border-color: black"/></p>
	    <p>时间:<input type="text" name="mdate" v-model="addForm.mdate"  style="width: 150px;border-color: black"/></p>
	    <p>诊断信息:<input type="text" name="diagnosis" v-model="addForm.diagnosis"  style="width: 150px;border-color: black"/></p>
	    <input type="button"  value="添加" @click="add"/>
	</form>
	
	
	<form  method="get" >
	    <p>病例号:<input type="text" name="mnum" v-model="updateForm.mnum" style="width: 150px;border-color: black"/></p>
	    <p>学号:<input type="text" name="sno"  v-model="updateForm.sno" style="width: 150px;border-color: black"/></p>
	    <p>诊断医生名字:<input type="text" name="dname"  v-model="updateForm.dname" style="width: 150px;border-color: black"/></p>
	    <p>时间:<input type="text" name="mdate"  v-model="updateForm.mdate" style="width: 150px;border-color: black"/></p>
	    <p>诊断信息:<input type="text" name="diagnosis"  v-model="updateForm.diagnosis" style="width: 150px;border-color: black"/></p>
	    <input type="button"  value="更新" @click="update"/>
	</form>

</template>

<script>
	export default {
		data() {
			return {
				searchForm: {
					mnum: "",
				},
				deleteForm: {
					mnum: "",
				},
				addForm: {
					sno: "",
					dname: "",
					mdate: "",
					diagnosis: "",
				},
				updateForm: {
					mnum: "",
					sno: "",
					dname: "",
					mdate: "",
					diagnosis: "",
				},
			}
		},
		methods: {
			async search() {
				const {
					data: res
				} = await this.$http.get("medicalchart/selectOne?mnum=" + this.searchForm.mnum);
				this.$alert(res, '查询结果', {
					confirmButtonText: '确定',
				});
			},
			async del() {
				const {
					data: res
				} = await this.$http.get("medicalchart/deleteOne?mnum=" + this.deleteForm.mnum);
				if (res) {
					this.$alert("删除成功", '删除结果', {
						confirmButtonText: '确定',
					});
				} else {
					this.$alert("删除失败", '删除结果', {
						confirmButtonText: '确定',
					});
				}
	
			},
			async add() {
				const {
					data: res
				} = await this.$http.get("medicalchart/addOne?", {
					params: this.addForm
				});
				this.$alert(res, '添加结果', {
					confirmButtonText: '确定',
				});
			},
			async update() {
				const {
					data: res
				} = await this.$http.get("medicalchart/updateOne?", {
					params: this.updateForm
				});
				this.$alert(res, '更新结果', {
					confirmButtonText: '确定',
				});
			},
		},
	}
</script>

<style>
</style>
